home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / basic / bmw2.zip / TEST.BAS < prev   
BASIC Source File  |  1989-02-19  |  5KB  |  153 lines

  1. 'To run TEST.BAS:
  2. 'create BARMENU.QLB - run BARQLB.BAT
  3. 'Start QB like so; QB TEST /L BARMENU <enter>
  4.  
  5. '$INCLUDE: 'BARMENU.BI'         'Declares COMMON BLOCK variables.
  6.                 'Add to the list if you need more variables
  7.                 'that have the COMMON SHARED attribute.
  8. DIM SSA%(9999)                  'Screen Save Array
  9.                 '5 screen saves available @ 2000 words per
  10.                 'screen. You can make bigger or smaller
  11.                 'depending on your needs. The next two
  12.                 'dim statements are adjusted (according to
  13.                 'the size of SSA%) for you.
  14. DIM CY%(UBOUND(SSA%) \ 2000)    'Cursor Y position save/restore array.
  15. DIM CX%(UBOUND(SSA%) \ 2000)    'Cursor X position save/restore array.
  16.  
  17. DEFINT M, S     'Integers Menu and Selection
  18.  
  19. Video       'a call to Video should be one of the first things you do.
  20. Saveit      'NEVER call SaveIt (or RestoreIt) before you have called Video
  21.  
  22. VIEW PRINT 1 TO 25
  23. CLS
  24.  
  25. 'Do NOT call bar if you have used VIEW PRINT to exclude printing on a
  26. 'line it needs! To do so will yield an ERROR, of the Illegal Function
  27. 'Call variety. If you use VIEW PRINT, set it before the call to BAR and
  28. 'again afterwards, like so:
  29. '   VIEW PRINT 10 TO 20
  30. '   .
  31. '   .
  32. '   .
  33. '   VIEW PRINT 1 TO 25
  34. '   CALL BAR(Menu%, Selection%)
  35. '   VIEW PRINT 10 TO 20
  36. '   ...
  37. 'If this becomes an inconvenience, you may want to use CURSOR.OBJ,
  38. 'distributed with BMW.EXE. It makes two BIOS calls, and may be a tad
  39. 'slower than LOCATE. See the description of CURSOR.OBJ in BMW.DOC.
  40. '
  41. 'BAR may be called with Integers Menu and Selection set to valid values.
  42. 'This will cause BAR to drop the appropriate menu and place the Selection
  43. 'bar on the appropriate menu item. If a divide bar is in a drop menu, you
  44. 'count it when determining a valid selection number. For example, if a
  45. 'divide bar separates menu item three from menu item 2, and you want menu
  46. 'item 3 to be 'on' when you call BAR, then assign Selection the value of 4.
  47. 'The value 3 would be invalid, and BAR will use the default of 1.
  48. 'When BAR is called with Selection valid, and Menu = 0, BAR will use
  49. 'a default of 1 for Menu, drop the first menu, and the menu bar will
  50. 'highlight the appropriate menu selection.
  51.  
  52. 'BAR may be called with Integer Menu valid, and Selection = 0. In this
  53. 'case, BAR will be prepared to drop the appropriate menu when the Enter key
  54. 'is hit.
  55.  
  56. 'If you call BAR with Menu = 0, and Selection = a valid value, BAR will use
  57. 'a default of 1 for Menu and drop menu #1, with the selection bar on the
  58. 'appropriate item.
  59.  
  60. 'Whenever Integers Menu and Selection = 0, BAR uses the default
  61. 'values of 1 for Menu and Selection. A menu will not drop, however, until
  62. 'the enter key is hit.
  63.  
  64. 'You can of course call BAR with two integers named whatever you wish. Just
  65. 'make sure they are integers! I mean integers%....(!)
  66. 'The following will work.
  67. 'CALL BAR(Fred%, Sam%)      'Specify integers and you can't go wrong
  68. 'or
  69. 'DEFINT D, E                'Variable Declaration Dwhatever and Ewhatever are
  70. 'CALL BAR(Damaris, Edith)   'integers.
  71. 'If you call BAR with other than integer variables, you'll get inconclusive
  72. 'results, strange things may happen, and you might even crash.
  73. '
  74. 'SaveIt and RestorIt:
  75. 'Never call SaveIt or RestoreIt before you have called Video.
  76. 'The Screen and Cursor position are saved in three arrays. A pointer keeps
  77. 'track of these arrays.
  78. 'Do not call RestoreIt unless a previous call to SaveIt has been done.
  79. 'Do not call SaveIt more times than than the array sizes will allow.
  80. 'SAMPLE:
  81. 'Call Video
  82. '.
  83. '.
  84. '.                   "Array pointer (AP%) = 0
  85. 'SaveIt              "Array pointer (AP%) = 1 after call
  86. '│   .
  87. '│   .
  88. '│   .
  89. '│   SaveIt          "Array pointer (AP%) = 2 after call
  90. '│   │   .
  91. '│   │   .
  92. '│   │   .
  93. '│   │   SaveIt      "Array pointer (AP%) = 3 after call
  94. '│   │   │   .
  95. '│   │   │   .
  96. '│   │   │   .
  97. '│   │   RestoreIt   "Array pointer (AP%) = 2 after call
  98. '│   │   .
  99. '│   │   .
  100. '│   │   .
  101. '│   RestoreIt       "Array pointer (AP%) = 1 after call
  102. '│   .
  103. '│   .
  104. '│   .
  105. 'RestoreIt           "Array pointer (AP%) = 0 after call
  106. 'Don't call RestoreIt if AP% = 0
  107. FillScreen$ = STRING$(2000, "░")
  108. CALL Aprint(FillScreen$, NormalText%)
  109. Menu = 0
  110. Selection = 0
  111. CallBar:
  112. Saveit
  113. LOCATE 10, 30
  114. PRINT "Before call to BAR:";
  115. LOCATE 11, 30
  116. PRINT "Integer Menu ="; Menu
  117. LOCATE 12, 30
  118. PRINT "Integer Selection ="; Selection;
  119.  
  120. CALL Bar(Menu, Selection)
  121. LOCATE 13, 30
  122. PRINT "BARMENU RETURNS:";
  123. LOCATE 14, 30
  124. PRINT "Integer Menu ="; Menu;
  125. LOCATE 15, 30
  126. PRINT "Integer Selection ="; Selection;
  127. LOCATE 17, 30
  128. PRINT "Would you like to call BAR again? (y or n)";
  129.  
  130. GA:
  131. Answer$ = ""
  132. WHILE Answer$ = ""
  133.     Answer$ = INKEY$
  134. WEND
  135. IF LCASE$(Answer$) = "n" THEN
  136.     RestoreIt
  137.     END
  138. ELSEIF LCASE$(Answer$) = "y" THEN
  139.     RestoreIt
  140.     GOTO CallBar
  141. ELSE
  142.     SOUND 350, 1.6: SOUND 250, .8: SOUND 150, .5
  143.     GOTO GA
  144. END IF
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.